#ifndef IO_SERVICE_THREAD_H_INCLUDED
#define IO_SERVICE_THREAD_H_INCLUDED

/*
* Copyright (c) 2010 Michael Collins
*
* This file is part of TerraFirma.
*
* TerraFirma is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TerraFirma is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TerraFirma.  If not, see <http://www.gnu.org/licenses/>.
*/

/**A very simple thread object that runs the boost io_service for async transactions
 * This starts after the network thread and allows it to communicate over the network
 * and terminates when the network thread closes.
 */
#include <boost/asio.hpp>
#include <cstdio>

namespace engine
{
    class io_service_thread
    {
        public:
        io_service_thread(boost::asio::io_service& serv) : service(serv) {}

        void operator()()
        {
            printf("io_service started.\n");
            service.run();
        }

        private:
        boost::asio::io_service& service;
    };
}



#endif // IO_SERVICE_THREAD_H_INCLUDED
